package cn.itsource.basic.job;

import cn.itsource.basic.job.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.Schedules;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

@Component //spring管理
public class TimingRemindTask {

    @Autowired
    private TaskService taskService;

    //    @Schedules({@Scheduled(cron = "0 15 11,14,16 * * ? "),@Scheduled(cron = "0 0 18 * * ? ")})
    @Schedules({@Scheduled(cron = "0/10 * * * * ?")})
    public void remindTask() throws InterruptedException {
/*        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println("执行定时任务了,执行时间为：" + sdf.format(new Date()));*/

        taskService.executeRemindMessage();
    }

}
